Component({
  options: {
    multipleSlots: true // 在组件定义时的选项中启用多slot支持
  },
  /**
   * 组件的初始数据
   */
  data: {
    yes: true,
    no: false,
    ybg: '#ffffff',
    nbg: "#ffffff",
    ycolor: "#2780F4",
    ncolor: "#333333",
    ybordercolor: "#2780F4",
    nbordercolor: "#ffffff",
  },
  properties: {
    title: {
      type: String,
      value: "标题"
    },
    yes: {
      type: String,
      value: '是'
    },
    no: {
      type: String,
      value: '否'
    },
    select: {
      type: Boolean,
      value: true,
      // 值发生改变时候调用
      observer(newVal, oldVal, changedPath) {
        if (newVal) {
          this.setData({
            ybg: '#ffffff',
            ycolor: '#2780F4',
            ybordercolor: "#2780F4",
            ncolor: "#333333",
            nbordercolor: "#ffffff"
          })

        } else {
          this.setData({
            ncolor: '#2780F4',
            nbordercolor: "#2780F4",
            ybg: "#ffffff",
            ycolor: '#333333',
            ybordercolor: "#ffffff"
          })
        }
      }
    }
  },
  methods: {
    yes() {
      this.triggerEvent("yes")
      this.setData({
        ybg: '#ffffff',
        ycolor: '#2780F4',
        ybordercolor: "#2780F4",
        ncolor: "#333333",
        nbordercolor: "#ffffff"
      })
    },
    no() {
      this.triggerEvent("no")
      this.setData({
        ncolor: '#2780F4',
        nbordercolor: "#2780F4",
        ybg: "#ffffff",
        ycolor: '#333333',
        ybordercolor: "#ffffff"
      })
    }
  },
})